#include "stdafx.h"
#include "PortIndex.h"

namespace RoomFW {

PortIndex::PortIndex(void) :
	index_(0, 0)
{
}

PortIndex::PortIndex(PrimaryIndex port, ReplicationIndex replication) :
	  index_(port, replication)
{
}

PortIndex::PrimaryIndex PortIndex::port(void) const
{
	return index_.first;
}

void PortIndex::port(PrimaryIndex _port)
{
	index_.first = _port;
}

PortIndex::ReplicationIndex PortIndex::replication(void) const
{
	return index_.second;
}

void PortIndex::replication(ReplicationIndex _replication)
{
	index_.second = _replication;
}

bool PortIndex::operator<(const PortIndex& rhs) const
{
	return (this->index_ < rhs.index_);
}

bool PortIndex::operator==(const PortIndex& rhs) const
{
	return (this->index_ == rhs.index_);
}

bool PortIndex::operator!=(const PortIndex& rhs) const
{
	return (this->index_ != rhs.index_);
}

void PortIndex::serialize(::boost::archive::binary_oarchive& ar, const unsigned int /*version*/) const
{
	ar << index_.first;
	ar << index_.second;
}

void PortIndex::serialize(::boost::archive::binary_iarchive& ar, const unsigned int /*version*/)
{
	ar >> index_.first;
	ar >> index_.second;
}

}

//BOOST_CLASS_TRACKING(RoomFW::PortIndex, ::boost::serialization::track_never)
